package com.ys.service.sys;

import java.util.List;

import org.springframework.ui.Model;

import com.ys.dto.DtreeSqlDto;
import com.ys.vo.R;

import lombok.AllArgsConstructor;
import lombok.Data;

public interface YsModalSelectorFieldService {

	DtreeSqlDto dtree();
	
	R add(Long pid,
			String code,
			String name,
			String type,
			Integer sortNo,
			Integer stateCondition,
			String conditionCode,
			String dictKeyBase,
			Integer align,
			Integer width);
	
	R edit(Long id, String name, String code, String type, Integer stateCondition, String conditionCode);

	R delete(Long id);
	
	String toResort(Model model, Long pid);
	@Data
	@AllArgsConstructor
	public class ToResortDto{
		private List<RowDto> rows; // 数据行
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字段ID
			private String name; // 字段名称
		}
	}
	
	R resort(String rows);
	
	String toOptionSetting(Model model, Long id);
	@Data
	@AllArgsConstructor
	public static class ToOptionConfigDto{
		private Long id; // GUID
		private String name; // 字段名
		private String code; // 字段编码
		private String dictKey; // 字典KEY
		private List<RowDto> rows;
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字典ID
			private String dictName; // 字典名
			private String dictValue; // 字典值
		}
	}

	R optionSetting(Long id, String dictKey);

}